﻿using System;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using MS.InformationManagement.Presenter.Support;
using MS.InformationManagement.Presenter.SearchRadicado;
using System.Collections.Generic;
using MS.InformationManagement.DAL.DocumentCenter;

namespace MS.InformationManagement.WP.Layouts.MS.InformationManagement.WP
{
    public partial class SearchRadicado : BaseApplicationPage
    {

        #region fields

        SearchRadicadoPresenter _presenter;

        #endregion

        #region Properties

        public IEnumerable<Radicado> FoundedItems { get; set; }

        public string RadicadoId
        {
            get
            {
                return this.txtRadicado.Text.Trim();
            }
        }

        public string Remitente
        {
            get
            {
                return this.txtRemitente.Text.Trim();
            }
        }

        public string TipoDocumental
        {
            get
            {
                return this.txtTipoDocumental.Text.Trim();
            }

        }

        #endregion

        #region form events

        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        protected void SearchAction(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            try
            {
                _presenter.SearchItems();
            }
            catch (Exception ex)
            {
                HandleError(ex);
            }
        }

        #endregion

        #region Implemented Methods

        public void LoadFoundedItems()
        {
            try
            {
                gvItems.DataSource = FoundedItems;
                gvItems.DataBind();
            }
            catch (Exception ex)
            {
                HandleError(ex);
            }
        }

        #endregion
    }
}
